//
//  PublishHeaderViewCell.swift
//  EyeVisionForPatients
//
//  Created by PMC on 2020/3/7.
//  Copyright © 2020 tao Tao. All rights reserved.
//

import UIKit

protocol PublishHeaderViewCellDelegate: NSObjectProtocol {
    func headerViewCell(didIntroduceAction cell: PublishHeaderViewCell)
}

class PublishHeaderViewCell: UITableViewCell {
    
    weak var delegate: PublishHeaderViewCellDelegate?
    
    func configure(with vm: DoctorDetailViewModel) {
        avatarView.kf.setImage(with: URL(string: vm.thumbnailUrl),
                               placeholder: UIImage(named: "avatar_default"))
        nameLabel.text = vm.doctorName
        deptAndOfficeLabel.text = vm.deptAndOffice
      //  hospitalLabel.text = vm.hospitalName
        starRatingView.currentStarCount = vm.score.floatValue
        scoreLabel.text = vm.score
        specialtyLabel.text = vm.specialty
    }
    
    func updateData(with vm: MyCloudDetailViewModel) {
        starRatingView.isHidden = true
        scoreLabel.isHidden = true
        //introduceBtn.isHidden = true
        nameLabel.text = vm.doctorName
        deptAndOfficeLabel.text = vm.deptAndJobTitle
       // hospitalLabel.text = vm.hospitalName
    }
    
    func configure(advisoryOrder vm: MyAdvisoryOrderRowViewModel,
                   patientDetail detailVm: AdvisoryDetailViewModel) {
        starRatingView.isHidden = true
        scoreLabel.isHidden = true
    //    introduceBtn.isHidden = true
        nameLabel.text = vm.doctorName
        deptAndOfficeLabel.text = vm.departmentName + " " + detailVm.doctorOffice
   //     hospitalLabel.text = vm.hospitalName
    }
    
    @IBOutlet private weak var avatarView: UIImageView! {
        didSet {
            avatarView.contentMode = .scaleAspectFill
            avatarView.layer.cornerRadius = 8
            avatarView.layer.masksToBounds = true
        }
    }
    
    @IBOutlet private weak var nameLabel: UILabel!
    
    @IBOutlet private weak var deptAndOfficeLabel: UILabel!

    @IBOutlet private weak var scoreLabel: UILabel!
    
    @IBOutlet private weak var starRatingView: StarRatingView!
    
    @IBOutlet private weak var specialtyLabel: UILabel!
    

}

extension PublishHeaderViewCell {

}
